package cn.genmer.test.security.alibaba.alipay;

import java.io.FileWriter;
import java.io.IOException;

public class AlipayConfig {
  // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号,开发时使用沙箱提供的APPID，生产环境改成自己的APPID

  public static String APP_ID = "2021000118625951";

  // 商户私钥，您的PKCS8格式RSA2私钥
  public static String APP_PRIVATE_KEY = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCeOdVWUrNVujtz07yGLCeec5sAmdSjRqDyQdM4kEIWcn0SpkNZeuSJ9PM9PB2Cskk5PS7euxbr0GNp1VrBhQS+mChoXoNLqBjbPpEUvlJERw1u8nBuRJf+bGgbTun+4ZVMKslwidYn6ovqbsiqWyvTF51aocKEL9pgrUFuDIu4w5x4sWS7+iQfZ7n0ApOKq8ANefiwEX1btnn3ECZcp+M9Z+uD7mXjYXkPHoYX7dMdDP1+qQCqnAc+hL4ScN82TvIVQEH0fnl6qv1m1Fv939updt8OunqOJ98UhibWSO43vqXkWhpF2WkX7yl8IDxJdJQJsKy3k93hBEHLzlgvufyPAgMBAAECggEAZVZ5En6JKWDLbxWvauegwFUeczYTADfeIQqTs2iBS0ssW+Nsw0R4VvsxRojYBbsWNri+6hw9Q+8FnOTu6X6+WSuuxZmy0aPpt5HM7dIvcldnfSV9aMI57tOTodna+EmWi1/kAFXneU05K36kuqcF3H8FYuSzZmIXpU+R1l/mpQBvtZ1HQCzrgx/cMeNVCjebHwWklWgkLAsXDxvPv+xwN2idlek6sH5BcxQgw7MfNyKqQ9SvicPInoXIqnAYWaipPEPoiRL14X+3x8AUPoXU5t6Opjwd6gsKY3CBG7ky7UYuKtI6Il6nAU0pG2rcBRREJ8wisbhh83gdn+WiFoXOwQKBgQDkhtzpWazllwKHW43KAaNho/1smKt65425NGnrbaFyVRUqSEnRnQzOMK4ImXqcuXvV/FhgVgA4LckdwF/ySwm9YNa71UDNnCpTOnPvpAUXrQdiFcBHYrZ4wpZXTLavb5rsCCAD5jcWhEBgIAe8lTSk6j3J7g9QlAksm7Dg9FmkfwKBgQCxP2QoQfz1cSMywXHH50uMIF3rnrTu8q5/Y9EKQMNTnviw0su+T5Ix1PnwRCgHynhlX9mHUmFqH/QeydJbYsfK4ZYzTbsMj2N9z/cbAsjZpT9PFCl9oB+b+ewsHniA4Uj+kM3ZNYJttKDtVyS8pVRucgozDRN6bmcprjkLqzVf8QKBgD5g9bIYkVJGKyGJgyWN1uwTGFzpO32b8RqJzRO/ZB9STCmze7rk1Jb/wLGGO2rGUqAxdmotb3fmP4yIc2guxWTVJyg0aLD3HLKFNRpHukAhMe+7IjYaItbJvsHrpb4zh6U//oUx9P2Hcg8LDzGRxMHzUpRpD/MdxXdQtDJjYIi/AoGATxSxYyTN79QimCqm0UHo+wQV42JT56hvIncudRygCVcMLhhevvJRj9ouCXzfP1qejNxO+YlP3UGUcYgqSouwCFzN3uX3ZoszIJcA8RQ0+KY5sNaWDG68q6K+NJEDwrzBDJMexKKTJs9IXZxbz68UFJLc6hoTbrSDYp1Q5lvk3IECgYBcA5KpuE8YGYGYFHpu0ZTkfNm7/ExtsHr9ozHUzJRc/1jOYgFPJwWXDXSYJMEpM9BbQ5p36bfjY9S4CtMTQuG2yXVlvuORxMj0C0/plQqhUIvX2/czr/Zr0Gh9gfJxBCejCK/zQyKZ4nTewCoviaSmjEdRKt4W27x+ukn6ko+XJw==";

  // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
  public static String ALIPAY_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtRYBhTIjwf5lFI6eeTfJEwDvLcryZXouLKXNTnpXwvpvmROTuy322hj8q8flUGHpG4I4hyrUfZdFGqTMf026XFACT2runwJRo4Rux4KXEs+y7j6eTqqXgoDfbtKUCaTW0xIdG/4sHI5a+gTs5Iis1Ncl3CJ4XLtT+dBBG8DpwxuUrYhdUAOmbVE+/9ghjunG49lhJ91gxVsHxNWzVv/FG9wUMLLkISW4KSzMdhms6k1GpbQLzPu8RvCsQNm5rm33QerQ6ECVXYPZPIhRCBzMSeSwE0Ia58MbhS2phM1jldVj+dzuASuDQ70PodBZbGaE1NS9AnFQpw/4aUa/0KeOoQIDAQAB";

  // 服务器异步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
  public static String notify_url = "http://localhost:8084/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

  // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问(其实就是支付成功后返回的页面)
  public static String return_url = "http://localhost:8080/alipay.trade.page.pay-JAVA-UTF-8/return_url.jsp";

  // 签名方式
  public static String sign_type = "RSA2";

  // 字符编码格式
  public static String CHARSET = "utf-8";

  // 支付宝网关，这是沙箱的网关
  public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

  // 支付宝网关
  public static String log_path = "C:\\";

//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

  /**
   * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
   *
   * @param sWord 要写入日志里的文本内容
   */
  public static void logResult(String sWord) {

    FileWriter writer = null;
    try {
      writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis() + ".txt");
      writer.write(sWord);
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      if (writer != null) {
        try {
          writer.close();
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
    }
  }
}